import 'package:core_package/core_package.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app_unionad/core/configuration.dart';
import 'package:flutter_app_unionad/ui/my_facility/my_facility_page.dart';
import 'package:flutter_app_unionad/ui/partnership/partnership_page.dart';
import 'package:flutter_app_unionad/ui/promotion/promotion_page.dart';
import 'package:flutter_app_unionad/ui/user_center/user_center_page.dart';
import 'package:flutter_app_unionad/ui/workbench/workbench_page.dart';

final List<Widget> pages = [
  MyFacilityPages(),
  PromotionPage(),
  PartnershipPage(),
  if (UserCacheUil.getInt(Configuration.userType) == 2) WorkbenchPage(),
  UserCenterPage(),
];

final List<BottomNavigationBarItem> bottomBarItems = [
  BuildBottomItems(
    norImage: "icon_tab1",
    selectImage: "icon_tab1_1",
    title: "我的设备",
  ),
  BuildBottomItems(
    norImage: "icon_tab2",
    selectImage: "icon_tab2_1",
    title: "推广",
  ),
  BuildBottomItems(
    norImage: "icon_tab5",
    selectImage: "icon_tab5_1",
    title: "合伙人",
  ),
  if (UserCacheUil.getInt(Configuration.userType) == 2)
    BuildBottomItems(
      norImage: "icon_tab4",
      selectImage: "icon_tab4_1",
      title: "工作台",
    ),
  BuildBottomItems(
    norImage: "icon_tab3",
    selectImage: "icon_tab3_1",
    title: "个人中心",
  ),
];

BottomNavigationBarItem BuildBottomItems({String? norImage, String? selectImage, String? title}) {
  return BottomNavigationBarItem(
    icon: Image.asset(
      MyAssetsImages.setAssetsImagesPath(norImage??''),
      width: 18,
      height: 18,
      gaplessPlayback: true,
    ),
    activeIcon: Image.asset(
      MyAssetsImages.setAssetsImagesPath(selectImage??''),
      width: 18,
      height: 18,
      gaplessPlayback: true,
    ),
    label: title,
  );
}
